(function(window,document){
    
    window.shakeIt = function(e) {
        e=typeof e==="string"?document.querySelector(e):e;
        var offsets = [ 0, 2, -2, 4, -4, 8, -8, 16, -16 ];    
        offsets = offsets.concat(offsets, offsets);
        var run = function() {
            e.style.transform = "translate(" + offsets.pop() + "px,0px)";
            if (offsets.length) {
                setTimeout(run, 1000 / 30);
            }
        }
        run();
    };
    
})(window,document);